package physics.shape;

import java.awt.geom.Ellipse2D;

import physics.Coordinate;



public class Circle extends Ellipse2D.Double implements ObstacleShape {

	
	public Circle(Coordinate coord,double diameter)
	{
		super(coord.getX(), coord.getY(), diameter, diameter);
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;


	/**
	 * Returns 
	 */
	@Override
	public boolean contains(Circle circle) {
		return false;
	//TODO
		
	}
	
	public Coordinate getCenter(){
		return new Coordinate(getX() + getWidth()/2, getY() + getHeight()/2);
	}

	
	/**
	 * returns true if the given circle intersects with this
	 * 
	 * @return
	 * 		|true if the radius of both circles is bigger then the distance between the centers
	 */
	@Override
	public boolean intersects(Circle circle) {
		double dist = Coordinate.getDistance(getCenter(), circle.getCenter());
		return ((getWidth()>=dist) && (circle.getWidth()>=dist));
	}

	
	public static void main(String args[]){
		Circle circle1 = new Circle(new Coordinate(50,50),30);
		Circle circle2 = new Circle(new Coordinate(70,60),30);
		
		System.out.println("intersects: " + circle1.intersects(circle2));
	}
	
	/**
	 * @return	The radius of the circle.
	 */
	public double getRadius(){
		return this.getWidth() / 2;
	}
	
	
	
}
